package com.jn.mvvm2.views;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import com.bumptech.glide.Glide;
import com.jn.mvvm2.R;
import com.jn.mvvm2.databinding.ActivityPetDetailBinding;
import com.jn.mvvm2.entity.Pet;

public class PetDetailActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityPetDetailBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_pet_detail);

        // 获取传递过来的PET对象
        Pet pet = getIntent().getParcelableExtra("PET");
        binding.setPet(pet);
        binding.setLifecycleOwner(this);

        // 使用Glide加载图片
        Glide.with(this).load(pet.getCoverURL()).into(binding.image1);
    }
}